
package woaini.wind.modules.plugin.domain;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.hutool.core.bean.copier.CopyOptions;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**

* @description /
* @author yefeng
* @date 2024-11-05
**/
@Entity
@Data
@Table(name="plugin_info")
public class PluginInfo implements Serializable {

    @Id
    @Column(name = "`plugin_id`")
    @Schema(title = "插件id")
    private String pluginId;

    @Column(name = "`create_by`")
    @Schema(title = "createBy")
    private String createBy;

    @Column(name = "`create_time`")
    @CreationTimestamp
    @Schema(title = "创建时间")
    private Timestamp createTime;

    @Column(name = "`update_by`")
    @Schema(title = "updateBy")
    private String updateBy;

    @Column(name = "`update_time`")
    @UpdateTimestamp
    @Schema(title = "updateTime")
    private Timestamp updateTime;

    @Column(name = "`class_loader_mode`",nullable = false)
    @NotBlank
    @Schema(title = "类加载模式")
    private String classLoaderMode;

    @Column(name = "`plugin_boot_class`")
    @Schema(title = "插件启动类")
    private String pluginBootClass;

    @Column(name = "`plugin_code`")
    @Schema(title = "插件code")
    private String pluginCode;

    @Column(name = "`plugin_desc`")
    @Schema(title = "插件描述")
    private String pluginDesc;

    @Column(name = "`plugin_ext`")
    @Schema(title = "插件扩展")
    private String pluginExt;

    @Column(name = "`plugin_version`")
    @Schema(title = "插件版本")
    private String pluginVersion;

    @Column(name = "`status`")
    @Schema(title = "状态")
    private String status;

    @Column(name = "`location`")
    @Schema(title = "存储地址")
    private String location;

    public void copy(PluginInfo source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
